#include "StdAfx.h"
#include "FadeEffect.h"
#include "../kernel.h"

extern Kernel* g_kernel;

#define TIME g_kernel->GetTime()


FadeEffect::FadeEffect(void)
{
    m_duration = 0; m_time = 0;
    SetStartColor( Vector4f(0,0,0,0) );
    m_endColor.Set( 1,1,1,1 );
}

FadeEffect::~FadeEffect(void)
{
}

/** Update the effects */
void FadeEffect::Update( long dt )
{
    if ( TIME > m_duration )
        return;

    Vector4f shift = m_endColor - m_currentColor;
    Vector4f fade  = shift * m_time;

    m_currentColor = m_currentColor + fade;
}